﻿using CCWin;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace TelephoneYiShou.XQL
{
    public partial class FrmEmpPer : Skin_Mac
    {
        public FrmEmpPer()
        {
            InitializeComponent();
        }
        DataTable dt;
        private void FrmEmpPer_Load(object sender, EventArgs e)
        {
            // TODO: 这行代码将数据加载到表“telephoneYiShouDataSet.SellGoods”中。您可以根据需要移动或删除它。
            this.sellGoodsTableAdapter.Fill(this.telephoneYiShouDataSet.SellGoods);
            string ssql = "select s.Employeeid,e.EmployeeName,count(*) counts,sum(Number)numbers,sum(Moneysum) moneysums from sellgoods s join Employee e on s.Employeeid = e.EmployeeID group by s.Employeeid, e.EmployeeName";
            dt = DBHelper.GetDataTable(ssql);
            dataGridView1.DataSource = dt;
        }
        //查询
        private void buttselect_Click(object sender, EventArgs e)
        {
            string name = textBox1.Text;
            string sql = string.Format("select s.Employeeid,e.EmployeeName,count(*) counts,sum(Number)numbers,sum(Moneysum) moneysums from sellgoods s join Employee e on s.Employeeid = e.EmployeeID where e.employeename like '%{0}%' group by s.Employeeid, e.EmployeeName", name);
            dt = DBHelper.GetDataTable(sql);
            dataGridView1.DataSource = dt;
        }
        //退出
        private void buttexit_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
